//
//  Functions.m
//  BooksLibrary
//
//  Created by admin on 7/23/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "UserDefaultFunctions.h"

@implementation UserDefaultFunctions
#pragma mark - SAVE DATA WITH KEY (NSDATA)
void saveDataWithKey(id data,NSString *key)
{
    NSData *data_ = [NSKeyedArchiver archivedDataWithRootObject:data];
    [[NSUserDefaults standardUserDefaults] setObject:data_ forKey:key];
}
 
#pragma mark - GET DATA WITH KEY (NSDATA)
id getDataWithKey(NSString *key)
{
    NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:key];
    return [NSKeyedUnarchiver unarchiveObjectWithData:data];
}
#pragma mark -
//- (void)saveprofile{
//    NSMutableArray *array = [NSMutableArray array];
//    NSMutableDictionary * dic =[NSMutableDictionary dictionary];
//    [dic setObject:@"An" forKey:@"Name"];
//    [dic setObject:@"24" forKey:@"Age"];
//    
//    [array addObject:dic];
//    saveDataWithKey(array, @"profile");
//}
//- (NSData*) getProfile{
//    NSData * data = [self dataWithKey:@"Profile"];
//}
@end
